//
//  SingleOilChartCell.m
//  QoilPublic
//
//  Created by SunChao on 2018/4/23.
//  Copyright © 2018年 孙超. All rights reserved.
//

#import "SingleOilChartCell.h"
#import "WSLineChartView.h"
@interface SingleOilChartCell()


@end
@implementation SingleOilChartCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setCellWithDataX:(NSArray *)dataX dataY:(NSArray *)dataY{
    
   
    CGFloat maxValue = [[dataY valueForKeyPath:@"@max.floatValue"] floatValue];
    if (maxValue<95) {
        maxValue += 5;
    }
    CGFloat minValue = [[dataY valueForKeyPath:@"@min.floatValue"] floatValue];
   
    if (minValue>5) {
        
        minValue -= 5;
    }
    
    if (dataX.count>0&&dataY.count>0) {
        
        self.textLabel.text = @"";
        WSLineChartView *wsLine = [[WSLineChartView alloc]initWithFrame:self.chartView.bounds xTitleArray:dataX yValueArray:dataY yMax:maxValue yMin:minValue];
        
        [self.chartView addSubview:wsLine];
        
    }else{
        
        self.textLabel.text = @"今日无数据";
        self.textLabel.textAlignment = NSTextAlignmentCenter;
    }
}

@end
